package kr.momo.tmaker 
{
	import flash.display.DisplayObject;
	import flash.display.Sprite;
	import flash.geom.Point;
	import kr.momo.tmaker.vo.DesignItemData;
	
	/**
	 * ...
	 * @author momo
	 */
	public class DesignItem extends Sprite 
	{
		//public var centerRotation:Number;
		//public var centerLength:Number;
		
		public function get originWidth():Number { return designItemData.originWidth; }
		public function get originHeight():Number { return designItemData.originHeight; }
		
		public function get itemWidth():Number { return displayObject.width; }
		public function get itemHeight():Number { return displayObject.height; }
		
		public function get itemScaleX():Number { return displayObject.scaleX; }
		public function get itemScaleY():Number { return displayObject.scaleY; }
		
		public function setScaleX( scaleX:Number ):void {
			displayObject.scaleX = scaleX;
		}
		public function setScaleY( scaleY:Number ):void {
			displayObject.scaleY = scaleY;
		}
		
		private var designItemData:DesignItemData;
		private var displayObject:DisplayObject;
		
		public function DesignItem( displayObject:DisplayObject, designItemData:DesignItemData = null ) 
		{
			if ( designItemData == null ) {
				this.designItemData = new DesignItemData();
			}
			
			this.displayObject = displayObject;
			addChild( displayObject );
			
			initDesignItemData();
		}
		
		private function initDesignItemData():void 
		{
			var tempScaleX:Number = displayObject.scaleX;
			var tempScaleY:Number = displayObject.scaleY;
			
			displayObject.scaleX = displayObject.scaleY = 1;
			designItemData.originWidth = displayObject.width;
			designItemData.originHeight = displayObject.height;
			
			displayObject.scaleX = tempScaleX;
			displayObject.scaleY = tempScaleY;
		}
		//public function 
		
	}

}